#include "widget.h"
#include "ui_widget.h"

#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

//    QPushButton *button = new QPushButton(this);
//    button->setText("关闭");
//    button->move(100, 200);

//    connect(button, &QPushButton::clicked, this, &Widget::Handler);
    connect(this, &Widget::mySignal, this, &Widget::Handler);

    emit mySignal("hello world");
}

Widget::~Widget()
{
    delete ui;
}

void Widget::Handler(const QString &str)
{
    this->setWindowTitle(str);
}

//void Widget::Handler()
//{

//}

//void Widget::mySignal()
//{

//}

void Widget::on_pushButton_clicked()
{
    this->setWindowTitle("world");
}

void Widget::on_pushButton_2_clicked()
{
    this->setWindowTitle("hello");
}
